package br.com.mmca.admrespaco.persistence;

import javax.inject.Inject;

import org.slf4j.Logger;

import br.gov.frameworkdemoiselle.stereotype.PersistenceController;
import br.gov.frameworkdemoiselle.template.JPACrud;

import br.com.mmca.admrespaco.domain.Reserva;

import java.util.List;
import javax.persistence.Query;

@PersistenceController
public class ReservaDAO extends JPACrud<Reserva, Long> {
	
	private static final long serialVersionUID = 1L;
	
	@Inject
	@SuppressWarnings("unused")
	private Logger logger;
	
	@SuppressWarnings("unchecked")
	public List<Reserva> findByEspaco(final Long idEspaco)
	{
	   Query query = getEntityManager().createQuery("select se from Reserva se where se.idEspaco = :idEspaco ");
	   query.setParameter("idEspaco", idEspaco);
	   List<Reserva> list =  query.getResultList();
	   return list;
	}
}
